#include <QtGui>
#include <QDebug>
#include "QInstruction.h"



QInstruction::QInstruction(QFile *file){
    mFile = file;
    QByteArray fileByte = mFile->read(1);
    mOpcode = fileByte.toInt(0,16);

    switch(mOpcode){
    ///////////////////////ACALL
    case 0x11:
    case 0x31:
    case 0x51:
    case 0x71:
    case 0x91:
    case 0xB1:
    case 0xD1:
    case 0xF1:
        mOpcodeString = "ACALL";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        ///////////////////////ADD
    case 0x24:
        mOpcodeString = "ADD";
        mInstructionByte = 2;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x25:
        mOpcodeString = "ADD";
        mInstructionByte = 2;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x26:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x27:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x28:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x29:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x2A:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x2B:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x2C:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x2D:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x2E:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x2F:
        mOpcodeString = "ADD";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
    case 0x34:
        mOpcodeString = "ADDC";
        mInstructionByte = 2;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x35:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x36:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x37:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x38:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x39:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x3A:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x3B:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x3C:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x3D:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x3E:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x3F:
        mOpcodeString = "ADDC";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
        ///////////////////////AJMP
    case 0x01:
    case 0x21:
    case 0x41:
    case 0x61:
    case 0x81:
    case 0xA1:
    case 0xC1:
    case 0xE1:
        mOpcodeString = "AJMP";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;

        /////////////////////////ANL
    case 0x52:
        mOpcodeString = "ANL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("A");
        break;
    case 0x53:
        mOpcodeString = "ANL";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("# ");
        setSource();
        break;
    case 0x54:
        mOpcodeString = "ANL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x55:
        mOpcodeString = "ANL";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x56:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x57:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x58:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x59:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x5A:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x5B:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x5C:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x5D:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x5E:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x5F:
        mOpcodeString = "ANL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
    case 0x82:
        mOpcodeString = "ANL";
        mInstructionByte = 2;
        mFlagString = "C";
        mDestinationString.append("C");
        mSourceString.append("bit ");
        setSource();
        break;
    case 0xB0:
        mOpcodeString = "ANL";
        mInstructionByte = 2;
        mFlagString = "C";
        mDestinationString.append("C");
        mSourceString.append("/bit ");
        setSource();
        break;

        ///////////////////////CJNE
    case 0xB4:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xB5:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        setReladdr();
        break;
    case 0xB6:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("@R0");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xB7:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("@R1");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xB8:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R0");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xB9:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R1");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBA:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R2");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBB:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R3");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBC:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R4");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBD:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R5");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBE:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R6");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;
    case 0xBF:
        mOpcodeString = "CJNE";
        mInstructionByte = 3;
        mFlagString = "C";
        mDestinationString.append("R7");
        mSourceString.append("# ");
        setSource();
        setReladdr();
        break;

        //////////////////////////////CLR
    case 0xC2:
        mOpcodeString = "CLR";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        break;
    case 0xC3:
        mOpcodeString = "CLR";
        mInstructionByte = 1;
        mFlagString = "C";
        mDestinationString.append("C");
        break;
    case 0xE4:
        mOpcodeString = "CLR";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        //////////////////////////////////CPL
    case 0xF4:
        mOpcodeString = "CPL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
    case 0xB3:
        mOpcodeString = "CPL";
        mInstructionByte = 1;
        mFlagString = "C";
        mDestinationString.append("C");
        break;
    case 0xB2:
        mOpcodeString = "CPL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        break;

        ///////////////////////////////DA
    case 0xD4:
        mOpcodeString = "DA";
        mInstructionByte = 1;
        mFlagString = "C";
        break;
        /////////////////////////////DEC
    case 0x14:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
    case 0x15:
        mOpcodeString = "DEC";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        break;
    case 0x16:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R0");
        break;
    case 0x17:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R1");
        break;
    case 0x18:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R0");
        break;
    case 0x19:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R1");
        break;
    case 0x1A:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R2");
        break;
    case 0x1B:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R3");
        break;
    case 0x1C:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R4");
        break;
    case 0x1D:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R5");
        break;
    case 0x1E:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R6");
        break;
    case 0x1F:
        mOpcodeString = "DEC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R7");
        break;
        ////////////////////////////DIV
    case 0x84:
        mOpcodeString = "DIV";
        mInstructionByte = 1 ;
        mDestinationString.append("AB");
        mFlagString = "C,OV";
        break;
        ///////////////////////////////DJNZ
    case 0xD5:
        mOpcodeString = "DJNZ";
        mInstructionByte = 3 ;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        setSource();
        break;
    case 0xD8:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R0");
        setSource();
        break;
    case 0xD9:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R1");
        setSource();
        break;
    case 0xDA:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R2");
        setSource();
        break;
    case 0xDB:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R3");
        setSource();
        break;
    case 0xDC:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R4");
        setSource();
        break;
    case 0xDD:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R5");
        setSource();
        break;
    case 0xDE:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R6");
        setSource();
        break;
    case 0xDF:
        mOpcodeString = "DJNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R7");
        setSource();
        break;
        //////////////////////INC
    case 0x04:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
    case 0x05:
        mOpcodeString = "INC";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        break;
    case 0x06:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R0");
        break;
    case 0x07:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R1");
        break;
    case 0x08:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R1");
        break;
    case 0x09:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R2");
        break;
    case 0x0A:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R3");
        break;
    case 0x0B:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R4");
        break;
    case 0x0C:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R5");
        break;
    case 0x0D:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R5");
        break;
    case 0x0E:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R6");
        break;
    case 0x0F:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R7");
        break;
    case 0xA3:
        mOpcodeString = "INC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("DPTR");
        break;
        /////////////////////////JB
    case 0x20:
        mOpcodeString = "JB";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        setSource();
        break;
        //////////////////////////JBC
    case 0x10:
        mOpcodeString = "JBC";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        setSource();
        break;
        /////////////////////////////////JC
    case 0x40:
        mOpcodeString = "JC";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        ////////////////////////////////JMP
    case 0x73:
        mOpcodeString = "JMP";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@A+DPTR");
        break;
        /////////////////////////////////JNB
    case 0x30:
        mOpcodeString = "JNB";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        setSource();
        break;
        ////////////////////////////////////JNC
    case 0x50:
        mOpcodeString = "JNC";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        ///////////////////////////JNZ
    case 0x70:
        mOpcodeString = "JNZ";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        ////////////////////////JZ
    case 0x60:
        mOpcodeString = "JZ";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        /////////////////////////LCALL
    case 0x12:
        mOpcodeString = "LCALL";
        mInstructionByte = 3;
        mFlagString = "None";
        setDestination();
        setSource();
        break;
        /////////////////////////////LJMP
    case 0x02:
        mOpcodeString = "LJMP";
        mInstructionByte = 3;
        mFlagString = "None";
        setDestination();
        setSource();
        break;
        /////////////////////////////MOV
    case 0x76:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("@R0");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x77:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("@R1");
        mSourceString.append("# ");
        setSource();
        break;
    case 0xF6:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R0");
        mSourceString.append("A");
        break;
    case 0xF7:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R1");
        mSourceString.append("A");
        break;
    case 0xA6:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("@R0");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xA7:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("@R1");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x74:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0xE6:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0xE7:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0xE8:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0xE9:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0xEA:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0xEB:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0xEC:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0xED:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0xEE:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0xEF:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
    case 0xE5:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xA2:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "C";
        mDestinationString.append("C");
        mSourceString.append("bit ");
        setSource();
        break;
    case 0x90:  ////////////////???data 16
        mOpcodeString = "MOV";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("DPTR");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x78:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R0");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x79:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R1");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7A:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R2");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7B:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R3");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7C:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R4");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7D:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R5");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7E:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R6");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x7F:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R7");
        mSourceString.append("# ");
        setSource();
        break;
    case 0xF8:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R0");
        mSourceString.append("A");
        break;
    case 0xF9:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R1");
        mSourceString.append("A");
        break;
    case 0xFA:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R2");
        mSourceString.append("A");
        break;
    case 0xFB:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R3");
        mSourceString.append("A");
        break;
    case 0xFC:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R4");
        mSourceString.append("A");
        break;
    case 0xFD:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R5");
        mSourceString.append("A");
        break;
    case 0xFE:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R6");
        mSourceString.append("A");
        break;
    case 0xFF:
        mOpcodeString = "MOV";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("R7");
        mSourceString.append("A");
        break;
    case 0xA8:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R0");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xA9:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R1");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAA:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R2");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAB:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R3");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAC:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R4");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAD:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R5");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAE:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R6");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0xAF:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("R7");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x92:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        mSourceString.append("C");
        break;
    case 0x75:
        mOpcodeString = "MOV";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("# ");
        setSource();
        break;
    case 0x86:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("@R0");
        break;
    case 0x87:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("@R1");
        break;
    case 0x88:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R0");
        break;
    case 0x89:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R1");
        break;
    case 0x8A:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R2");
        break;
    case 0x8B:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R3");
        break;
    case 0x8C:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R4");
        break;
    case 0x8D:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R5");
        break;
    case 0x8E:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R6");
        break;
    case 0x8F:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("R7");
        break;
    case 0xF5:
        mOpcodeString = "MOV";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("A");
        break;
    case 0x85:
        mOpcodeString = "MOV";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("iram ");
        setSource();
        break;
        ////////////////////////////////MOVC
    case 0x93:
        mOpcodeString = "MOVC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@A+DPTR");
        break;
    case 0x83:
        mOpcodeString = "MOVC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@A+PC");
        break;
        ////////////////////////////////MOVX
    case 0xF0:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@DPTR");
        mSourceString.append("A");
        break;
    case 0xF2:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R0");
        mSourceString.append("A");
        break;
    case 0xF3:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("@R1");
        mSourceString.append("A");
        break;
    case 0xE0:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@DPTR");
        break;
    case 0xE2:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0xE3:
        mOpcodeString = "MOVX";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
        /////////////////////////MUL
    case 0xA4:
        mOpcodeString = "MUL";
        mInstructionByte = 1;
        mFlagString = "C,OV";
        mDestinationString.append("AB");
        break;
         /////////////////////////NOP
    case 0x00:
        mOpcodeString = "NOP";
        mInstructionByte = 1;
        mFlagString = "None";
        break;
        /////////////////ORL
    case 0x42:
        mOpcodeString = "ORL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("A");
        break;
    case 0x43:
        mOpcodeString = "ORL";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("# ");
        setSource();
        break;
    case 0x44:
        mOpcodeString = "ORL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x45:
        mOpcodeString = "ORL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x46:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x47:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x48:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x49:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x4A:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x4B:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x4C:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x4D:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x4E:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x4F:
        mOpcodeString = "ORL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
    case 0x72:
        mOpcodeString = "ORL";
        mInstructionByte = 2;
        mFlagString = "C";
        mDestinationString.append("C");
        mSourceString.append("bit ");
        setSource();
        break;
    case 0xA0:
        mOpcodeString = "ORL";
        mInstructionByte = 2;
        mFlagString = "C";
        mDestinationString.append("C");
        mSourceString.append("/bit ");
        setSource();
        break;
        ///////////////////POP
    case 0xD0:
        mOpcodeString = "POP";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        break;
        /////////////////////////PUSH
    case 0xC0:
        mOpcodeString = "PUSH";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        break;
        /////////////////////////RET
    case 0x22:
        mOpcodeString = "RET";
        mInstructionByte = 1;
        mFlagString = "None";
        break;
       /////////////////////RETI
    case 0x32:
        mOpcodeString = "RETI";
        mInstructionByte = 1;
        mFlagString = "None";
        break;
     //////////////////////////RL
    case 0x23:
        mOpcodeString = "RL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        /////////////////////////RLC
    case 0x33:
        mOpcodeString = "RLC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        ////////////////RR
    case 0x03:
        mOpcodeString = "RR";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        ////////////////////////////////RRC
    case 0x13:
        mOpcodeString = "RRC";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        //////////////////////////////SETB
    case 0xD3:
        mOpcodeString = "SETB";
        mInstructionByte = 1;
        mFlagString = "C";
        mDestinationString.append("C");
        break;
    case 0xD2:
        mOpcodeString = "SETB";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("bit ");
        setDestination();
        break;
        ///////////////////////////////SJMP
    case 0x80:
        mOpcodeString = "JSMP";
        mInstructionByte = 2;
        mFlagString = "None";
        setDestination();
        break;
        ////////////////////////////SUBB
    case 0x94:
        mOpcodeString = "SUBB";
        mInstructionByte = 2;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x95:
        mOpcodeString = "SUBB";
        mInstructionByte = 2;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x96:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x97:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x98:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x99:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x9A:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x9B:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x9C:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x9D:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x9E:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x9F:
        mOpcodeString = "SUBB";
        mInstructionByte = 1;
        mFlagString = "C,AC,OV";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
       ///////////////////////////////SWAP
    case 0xC4:
        mOpcodeString = "SWAP";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        break;
        /////////////////////////Undefined Instruction
    case 0xA5:
        mOpcodeString = "???";
        mInstructionByte = 1;
        mFlagString = "C";
        break;
        //////////////////////////////////XCH
    case 0xC6:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0xC7:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0xC8:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0xC9:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0xCA:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0xCB:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0xCC:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0xCD:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0xCE:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0xCF:
        mOpcodeString = "XCH";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;
    case 0xC5:
        mOpcodeString = "XCH";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
        ////////////////////////////XCHD
    case 0xD6:
        mOpcodeString = "XCHD";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0xD7:
        mOpcodeString = "XCHD";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
        ////////////////////////////XRL
    case 0x62:
        mOpcodeString = "XRL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("A");
        break;
    case 0x63:
        mOpcodeString = "XRL";
        mInstructionByte = 3;
        mFlagString = "None";
        mDestinationString.append("iram ");
        setDestination();
        mSourceString.append("# ");
        setSource();
        break;
    case 0x64:
        mOpcodeString = "XRL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("# ");
        setSource();
        break;
    case 0x65:
        mOpcodeString = "XRL";
        mInstructionByte = 2;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("iram ");
        setSource();
        break;
    case 0x66:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R0");
        break;
    case 0x67:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("@R1");
        break;
    case 0x68:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R0");
        break;
    case 0x69:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R1");
        break;
    case 0x6A:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R2");
        break;
    case 0x6B:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R3");
        break;
    case 0x6C:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R4");
        break;
    case 0x6D:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R5");
        break;
    case 0x6E:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R6");
        break;
    case 0x6F:
        mOpcodeString = "XRL";
        mInstructionByte = 1;
        mFlagString = "None";
        mDestinationString.append("A");
        mSourceString.append("R7");
        break;

    }
}

void QInstruction::setDestination(){
    QByteArray fileByteDes = mFile->read(1);
    mDestinationString.append(fileByteDes.toHex());

}

void QInstruction::setSource(){
    QByteArray fileByteSrc = mFile->read(1);
    mSourceString.append(fileByteSrc.toHex());

}

void QInstruction::setReladdr(){
    QByteArray fileByteReladdr = mFile->read(1);
    mReladdr.append(fileByteReladdr.toHex());

}

